package com.lunwen.lunwen.services.impl;

import com.lunwen.lunwen.bean.MuBanRenWu;
import com.lunwen.lunwen.mapper.MuBanRenWuMapper;
import com.lunwen.lunwen.services.MuBanRenWuService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * (MuBanRenWu)表服务实现类
 *
 * @author makejava
 * @since 2020-07-24 12:30:25
 */
@Service
public class MuBanRenWuServiceImpl implements MuBanRenWuService {

    @Autowired
    private MuBanRenWuMapper muBanRenWuMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param mubanrenwuId 主键
     * @return 实例对象
     */
    @Override
    public MuBanRenWu queryById(String mubanrenwuId) {
        return this.muBanRenWuMapper.queryById(mubanrenwuId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<MuBanRenWu> queryAllByLimit(Integer zhuangtai, int offset, int limit) {
        return this.muBanRenWuMapper.queryAllByLimit(zhuangtai, offset, limit);
    }

    /**
     * 新增数据
     *
     * @param muBanRenWu 实例对象
     * @return 实例对象
     */
    @Override
    public MuBanRenWu insert(MuBanRenWu muBanRenWu) {
        this.muBanRenWuMapper.insert(muBanRenWu);
        return muBanRenWu;
    }

    /**
     * 修改数据
     *
     * @param muBanRenWu 实例对象
     * @return 实例对象
     */
    @Override
    public MuBanRenWu update(MuBanRenWu muBanRenWu) {
        this.muBanRenWuMapper.update(muBanRenWu);
        return this.queryById(muBanRenWu.getMubanrenwuId());
    }

    /**
     * 通过主键删除数据
     *
     * @param mubanrenwuId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String mubanrenwuId) {
        return this.muBanRenWuMapper.deleteById(mubanrenwuId) > 0;
    }
}